package com.my.chapter12;

import com.sun.xml.internal.bind.v2.schemagen.xmlschema.Annotated;

public class practice21 {
    public static void main(String[] args) {
        try {
            new DerivedWE();
        } catch(Except1 ex1) {
            System.out.println("Caught " + ex1);
        }
    }
}

class Except1 extends Exception {
    public Except1(String s) { super(s); }
}

class BaseWithException {
    public BaseWithException() throws Except1 {
        throw new Except1("thrown by BaseWithException");
    }
}

class DerivedWE extends BaseWithException {
    // Produces compile-time error:
    // unreported exception Except1
    // ! public DerivedWE() {}
    // Gives compile error: call to super must be
    // first statement in constructor:
    //! public DerivedWE() {
    //! try {
    //! super();
    //! } catch(Except1 ex1) {
    //! }
    //! }
    public DerivedWE() throws Except1 {}
}


